<!-- application/views/scripts/manage/index.phtml -->
<?php $this->headScript()->appendFile($this->baseUrl("/js/manage/index.js")); ?>
<?php $this->headTitle()->prepend('Home'); ?>

<?php if ( count($this->messages) ) :?>
<div class="span-24 last" id="manage-messages">
	<ul>
		<?php foreach ($this->messages as $i => $message ): ?>
			<li class="<?php echo @$message['type']?>">
				<img src="<?php echo @$this->baseUrl("/images/msg_{$message['type']}.png");?>" alt="<?php echo @$message['type']; ?>" />
				<?php echo $message['text']?>
			</li>
		<?php endforeach; ?>
	</ul>
</div>
<?php endif; ?>

<?php if ( count($this->news) ) :?>
<div class="span-24 last" id="manage-news">
	<div class="span-1" id="manage-news-leftarrow">
		<img src="<?php echo $this->baseUrl('/images/left_arrow_big.png'); ?>" alt="left" />
	</div>
	<div class="belt span-22">
		<?php foreach ($this->news as $i => $news) : ?>
			<div class="manage-news-article">
				<h3><?php echo @$news['title']?></h3>
				<?php echo @$news['text']; ?>
			</div>
		<?php endforeach; ?>
	</div>
	<div class="span-1 last" id="manage-news-rightarrow">
		<img src="<?php echo $this->baseUrl('/images/right_arrow_big.png'); ?>" alt="right" />
	</div>
</div>
<?php endif; ?>

<!-- First class links -->
<div class="span-24 last manage-container" id="manage-maincontainer">
	<div class="span-24 last header">
		<h2><?php echo X_Env::_('manage_mainbox_header'); ?></h2>
	</div>
	<div class="span-23 last boxes box">
		<div class="span-15">
			<?php foreach ($this->coreLinks as $i => $link ): ?>
				<div class="span-4 box clickable">
					<h4><?php echo $link['title']; ?></h4>
					<center>
						<img alt="<?php echo $link['label']; ?>" class="thumb" src="<?php echo $this->baseUrl($link['icon']);?>" />
					</center>
					<a href="<?php echo $link['link']?>">
						<img class="arrow" src="<?php echo $this->baseUrl('/images/right_arrow.png'); ?>" />
						<?php echo $link['label']?>
					</a>
				</div>
			<?php endforeach; ?>
		</div>
		<?php if ( count($this->actionLinks) ) :?>
			<div class="span-7 box last">
				<h4><?php echo X_Env::_('manage_goto_actionstitle'); ?></h4>
				<div class="scrollable">
					<ul class="hoverable">
						<?php foreach ( $this->actionLinks as $i => $link) :?>
							<li>
								<a href="<?php echo $link['link']?>">
									<?php if ( @$link['icon'] ) : ?>
										<img class="icon" src="<?php echo $this->baseUrl($link['icon']); ?>" />
									<?php else: ?>
										<img class="icon" src="<?php echo $this->baseUrl('/images/right_arrow.png'); ?>" />								
									<?php endif; ?>
									<?php echo $link['label']?>
								</a>
							</li>
						<?php endforeach; ?>
					</ul>
				</div>
			</div>
		<?php endif; ?>		
	</div>
</div>

<!-- Second class links -->
<div class="span-24 last manage-container" id="manage-altcontainer">
	<div class="span-24 header last">
		<h2><?php echo X_Env::_('manage_altbox_header'); ?></h2>
	</div>
	<div class="span-23 boxes box last">
		<div class="span-15">
			<?php foreach ($this->manageLinks as $i => $link ): ?>
				<div class="span-4 box clickable">
					<h4><?php echo $link['title']; ?></h4>
					<div class="span-1">
						<?php if ( @$link['icon'] ):?>
							<img alt="<?php echo $link['label']; ?>" class="thumb" src="<?php echo $this->baseUrl($link['icon']);?>" />
						<?php else:?>
							<img alt="<?php echo $link['label']; ?>" class="thumb" src="<?php echo $this->baseUrl('/images/manage/plugin.png');?>" />
						<?php endif;?>
					</div>
					<div class="span-3 last mainlink">
						<a href="<?php echo $link['link']?>">
							<img class="arrow" src="<?php echo $this->baseUrl('/images/right_arrow.png'); ?>" />
							<?php echo $link['label']?>
						</a>
					</div>
					<?php if ( @count($link['subinfos']) ):?>
						<ul>
							<?php foreach ( $link['subinfos'] as $j => $info) :?>
								<li>
									<?php echo $info; ?>
								</li>
							<?php endforeach; ?>
						</ul>
					<?php endif;?>
				</div>
			<?php endforeach; ?>
		</div>
		<?php if ( count($this->statistics ) ) :?>
			<div class="span-8 last" id="manage-statistics">
				<h3><?php echo X_Env::_('manage_statistics'); ?></h3>
				<?php foreach ($this->statistics as $i => $statistic) : ?>
					<div class="span-8 last statistic">
						<div class="span-7 last box title clickable">
							<div class="boxitem-stackicon ui-state-default" title="Mostra">
								<span class="ui-icon ui-icon-triangle-1-s">Mostra</span>
							</div>
							<h4><?php echo @$statistic['title'] ?></h4>
						</div>
						<div class="span-7 box last folded">
							<?php if (is_array(@$statistic['provider']) ) :?>
								<?php echo $this->action(
										@$statistic['provider']['action'],
										@$statistic['provider']['controller'],
										@$statistic['provider']['module'],
										@$statistic['provider']['params']); ?>
							<?php else:?>
								<ul>
									<?php foreach ( @$statistic['stats'] as $i => $stat) :?>
										<li><?php echo $stat; ?></li>
									<?php endforeach; ?>
								</ul>
							<?php endif;?>
						</div>
					</div>
				<?php endforeach; ?> 
			</div>
		<?php endif; ?>		
	</div>
</div>
